//
//  ViewController.m
//  UI_NavigationCtrollerHomework
//
//  Created by dllo on 16/7/21.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"
#import "ADDViewController.h"
#import "LeftViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
      [super viewDidLoad];
  
            UISegmentedControl *segment = [[UISegmentedControl alloc]initWithItems:@[@"消息", @"电话"]];
      self.navigationItem.titleView = segment;
      self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
      self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(handleright:)];
      UIButton *buttonleft = [[UIButton alloc]initWithFrame:CGRectMake(10, 10, 32, 32)];
      [buttonleft setImage:[UIImage imageNamed:@"4000006195f9a37a67b921aa23973478"] forState:UIControlStateNormal];
      UIBarButtonItem *leftcustomButtonView = [[UIBarButtonItem alloc]initWithCustomView:buttonleft];
     
      self.navigationItem.leftBarButtonItem = leftcustomButtonView;
      [buttonleft addTarget:self action:@selector(loginleft:) forControlEvents:UIControlEventTouchUpInside];
      [self TitleName];
      
}

- (void)TitleName {
      self.tabBarController.tabBar.tintColor = [UIColor colorWithRed:255.0/255.0 green:124.0/255.0 blue:56.0/255.0 alpha:1];
      //处理图片 变本来颜色
//      self.tabBarItem.image = [[UIImage imageNamed:@"Unknown"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
}

- (void)handleright:(UIBarButtonItem *)right {
      [self.navigationController pushViewController:[[ADDViewController alloc]init] animated:YES];
      //底部显示
      self.navigationController.hidesBottomBarWhenPushed = YES;
      
}

- (void)loginleft:(UIBarButtonItem *)left {
     //页面翻动效果 push pop都可使用
      CATransition *animation = [CATransition animation];
      
      [animation setDuration:0.3];
      
      [animation setType: kCATransitionMoveIn];
      
      [animation setSubtype: kCATransitionFromLeft];
      
      [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
        self.navigationController.hidesBottomBarWhenPushed = YES;
      
      
      [self.navigationController pushViewController:[[LeftViewController alloc]init] animated:NO];
      
      
      
      [self.navigationController.view.layer addAnimation:animation forKey:nil];
      

    
}
@end
